/*
 * Powered By XY
 * Since 2020
 */

package com.xy.biz.rs.manager.impl;

import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xy.biz.rs.domain.bo.MaterialBO;
import com.xy.biz.rs.domain.query.MaterialQuery;
import com.xy.biz.rs.domain.converter.MaterialConverter;
import com.xy.biz.rs.manager.MaterialManager;
import com.xy.biz.rs.dao.MaterialDao;

/**
 *
 *
 * @author yzh
 * @date 2021-4-14
 */
@Service
public class MaterialManagerImpl implements MaterialManager {

	@Autowired
	private MaterialDao materialDao;

	@Override
	public int saveMaterial(MaterialBO materialBO) {
		return materialDao.saveMaterial(MaterialConverter.toPO(materialBO));
	}

	@Override
	public int saveAllMaterial(Collection<MaterialBO> collection) {
		return materialDao.saveAllMaterial(MaterialConverter.toPO(collection));
	}

	@Override
	public int updateMaterial(MaterialBO materialBO) {
		return materialDao.updateMaterial(MaterialConverter.toPO(materialBO));
	}

	@Override
	public int deleteMaterial(Long materialId) {
		return materialDao.deleteMaterial(materialId);
	}

	@Override
	public MaterialBO getMaterial(Long materialId) {
		return MaterialConverter.fromPO(materialDao.getMaterial(materialId));
	}

	@Override
	public List<MaterialBO> listMaterialById(Collection<Long> collection) {
		return MaterialConverter.fromPO(materialDao.listMaterialById(collection));
	}

	@Override
	public List<MaterialBO> listMaterial(MaterialQuery query) {
		return MaterialConverter.fromPO(materialDao.listMaterial(query));
	}

	@Override
	public int countMaterial(MaterialQuery query) {
		return materialDao.countMaterial(query);
	}

}
